'This is used to store the theta and arrow form pairs. Given a theta, the dictionary will find the closest arrow form that matches the direction. For private use only. Shan August 18, 1989'!
!ThetaDictionary methodsFor: 'access'!
closestAt: theta
"Assume the keys are numbers. Shan August 18, 1989"
| bestSoFar delta closest |
bestSoFar _ 1000.
self
keysDo:
[:key |
delta _ (key - theta) abs.
delta < bestSoFar
ifTrue:
[bestSoFar _ delta.
closest _ self at: key]].
^closest copy "Shan March 30, 1990"!
closestAtVector: aPt
"The input is a vector. Map it to theta. The screen coordinates are
different than Cartian in that y is reversed. Shan March 7, 1990"